package com.ruoyi.project.WebMoudle.UserCollect.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.UserCollect.mapper.UserCollectMapper;
import com.ruoyi.project.WebMoudle.UserCollect.domain.UserCollect;
import com.ruoyi.project.WebMoudle.UserCollect.service.IUserCollectService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 收藏店铺Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-18
 */
@Service
public class UserCollectServiceImpl implements IUserCollectService 
{
    @Autowired
    private UserCollectMapper userCollectMapper;

    /**
     * 查询收藏店铺
     * 
     * @param id 收藏店铺ID
     * @return 收藏店铺
     */
    @Override
    public UserCollect selectUserCollectById(Long id)
    {
        return userCollectMapper.selectUserCollectById(id);
    }

    /**
     * 查询收藏店铺列表
     * 
     * @param userCollect 收藏店铺
     * @return 收藏店铺
     */
    @Override
    public List<UserCollect> selectUserCollectList(UserCollect userCollect)
    {
        return userCollectMapper.selectUserCollectList(userCollect);
    }

    /**
     * 新增收藏店铺
     * 
     * @param userCollect 收藏店铺
     * @return 结果
     */
    @Override
    public int insertUserCollect(UserCollect userCollect)
    {
        userCollect.setCreateTime(DateUtils.getNowDate());
        return userCollectMapper.insertUserCollect(userCollect);
    }

    /**
     * 修改收藏店铺
     * 
     * @param userCollect 收藏店铺
     * @return 结果
     */
    @Override
    public int updateUserCollect(UserCollect userCollect)
    {
        userCollect.setUpdateTime(DateUtils.getNowDate());
        return userCollectMapper.updateUserCollect(userCollect);
    }

    /**
     * 删除收藏店铺对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteUserCollectByIds(String ids)
    {
        return userCollectMapper.deleteUserCollectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除收藏店铺信息
     * 
     * @param id 收藏店铺ID
     * @return 结果
     */
    @Override
    public int deleteUserCollectById(Long id)
    {
        return userCollectMapper.deleteUserCollectById(id);
    }

    @Override
    public List<UserCollect> queryMyList(Long userId, String currentLng, String currentLat) {
        return userCollectMapper.queryMyList(userId,currentLng,currentLat);
    }

    @Override
    public int selectShopCount(Long shopId) {
        return userCollectMapper.selectShopCount(shopId);
    }

}
